<?php
##*HEADER*##

jimport('joomla.application.component.model');

class _ECR_COM_NAME_sModel_ECR_ELEMENT_NAME_ extends JModel
{
    function __construct()
    {
        parent::__construct();
    }//function

    function store($data)
    {
        $row =& $this->getTable('_ECR_ELEMENT_NAME_');

        if (!$row->bind($data)) {
            return false;
        }
        if (!$row->check()) {
            return false;
        }

        if (!$row->store()) {
            return false;
        }

        return true;
    }//function

    function delete()
    {
        $cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
        $row =& $this->getTable('_ECR_ELEMENT_NAME_');

        if (count( $cids )) {
            foreach($cids as $cid)
            {
                if (!$row->delete( $cid )) {
                    $this->setError( $row->getError() );
                    return false;
                }
            }//foreach
        }
        return true;
    }//function

    function getData()
    {
        $id = JRequest::getVar('cid');
        $row =& $this->getTable('_ECR_ELEMENT_NAME_');
        $row->load($id[0]);
        return $row;
    }//function

}//class
